﻿<%@ WebHandler Language="C#" Class="LoginHandler" %>

using System;
using System.Web;
using System.Web.SessionState;

public class LoginHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        string data_back = "";
        string action = context.Request["action"];
        switch (action)
        {
            case "validateUser":
                string username = context.Request["username"];
                string password = context.Request["password"];
                string rolename = context.Request["rolename"];
                data_back = LoginChecker.checkUser(username, password, rolename, context);
                break;
            case "getUserFromSession":
                data_back = LoginChecker.getUserFromSession();
                break;
        }
        context.Response.Write(data_back);
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}